package com.alnex.drools.model.filter;

import lombok.Data;
import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;

/**
 * 自定义 Agenda 过滤器
 *
 * @author Alnex
 * @date: 2020/11/2 16:32
 */
@Data
public class MyAgendaFilter implements AgendaFilter {

    private String ruleName;

    public MyAgendaFilter(String ruleName) {
        this.ruleName = ruleName;
    }

    @Override
    public boolean accept(Match match) {
        System.out.println("match.getRule().getName(): " + match.getRule().getName());
        System.out.println("ruleName: " + ruleName);
        return match.getRule().getName().equals(ruleName);
    }
}
